﻿@{
    Layout = null;
}
@model System.Collections.IEnumerable
<!DOCTYPE html>
@Html.Partial("LoadPanelPartial")
<html>
<head>
    @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

    )
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )
    <script type="text/javascript">

        $(function () {
            //  $("#toolMenu").smartFloat();
            ASPxClientTextBox.Cast("NSRMC").SetText($("#hidNSRMC").val());
            ASPxClientTextBox.Cast("FFileNo").SetText($('#FFileNo').val());
            //ASPxClientComboBox.Cast("HY_DM").SetValue($('#hidHY_DM').val());
            ASPxClientComboBox.Cast("FFinancePropNo").SetValue($('#hidFFinancePropNo').val());
            //ASPxClientComboBox.Cast("FEnterprisePropNo").SetValue($('#hidFEnterprisePropNo').val());
            //            if ($('#hidIsNoFull').val() == "Y") {
            //                //ASPxClientCheckBox.Cast("IsNoFull").SetChecked(true);
            //            }
            //            else {
            //                //ASPxClientCheckBox.Cast("IsNoFull").SetChecked(false);
            //            }
        });

        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
            e.customArgs["pageIndex"] = s.pageIndex;
            e.customArgs["pageCount"] = s.pageCount;
            e.customArgs["pageRowSize"] = s.pageRowSize;
            e.customArgs["pageRowCount"] = s.pageRowCount;

            e.customArgs["NSRMC"] = $('#hidNSRMC').val();
            e.customArgs["FFileNo"] = $('#FFileNo').val();
            e.customArgs["HY_DM"] = $('#hidHY_DM').val();
            e.customArgs["FFinancePropNo"] = $('#hidFFinancePropNo').val();
            e.customArgs["FEnterprisePropNo"] = $('#hidFEnterprisePropNo').val();
            e.customArgs["IsNoFull"] = $('#hidIsNoFull').val();
        }


        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnAdd":
                    {
                        //ImportDate();
                        //  TaxPayerManagerALLEdit();
                        onvalues();
                        //window.location.href = rootPath + "/AllowancePay/AllowancePayEdit"
                        //                        $("#popContent1").attr("src", rootPath + "/Key_NSRXX/PropAdd");
                        //                        codeModalMode1.Show();
                        break;
                    }
                case "btnDelete":
                    {
                        //TaxPayerManagerALLEdit();
                        codeDelList();
                        break;
                    }
            }
        }

        function ImportDate() {
            lpModal.Show();
            if (confirm("是否确定重新导入纳税人数据?")) {
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Key_NSRXX/ImportDate',
                    success: function (result) {
                        if (result == "e") {
                            alert("系统异常");
                            lpModal.Hide();
                        }
                        else {
                            alert("操作成功");
                            lpModal.Hide();
                            gvEditing.Refresh();
                        }
                    }
                });
            }
        }

        //查询
        function search() {
            //            var isnofull = "N";
            //            if (IsNoFull.GetChecked()) {
            //                isnofull = "Y";
            //            }
            var s = "";

            window.location.href = rootPath + "/AllowancePay/Index?NSRMC="
                        + NSRMC.GetText() + "&FFileNo=" + FFileNo.GetText() + "&HY_DM=" + s + "&FEnterprisePropNo="
                        + s + "&FFinancePropNo=" + FFinancePropNo.GetValue() + "&IsNoFull='N'";
        }

        function codeDel(codeNo) {
            if (confirm("确定删除？")) {
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Key_NSRXX/DelNSRXX?id=1',
                    data: { NSRDZDAH: codeNo },
                    success: function (result) {
                        if (result == "ok") {
                            alert("删除成功");
                            gvEditing.Refresh();
                            // window.location.href = rootPath + "/ZSFSManage/Index";
                        } else if (result == "error") {
                            alert("删除失败");
                        } else {
                            alert("参数错误");
                        }
                    }
                });
            }

        }
        function codeDelList(codeNo) {
            if (confirm("确定删除？")) {
                TaxPayerManagerALLEdit1();

            }
        }
        //        function TaxPayerManagerALLEdit1() {
        //            ASPxClientGridView.Cast("gvEditing").GetPageRowValues("NSRDZDAHstr", onvalues1);
        //        }

        //        function onvalues1(values) {
        //            var checkNo = "";
        //            var PageNoList = "";
        //            var checkNoList = ASPxClientGridView.Cast("gvEditing").GetSelectedKeysOnPage();
        //            for (var i = 0; i < checkNoList.length; i++) {
        //                checkNo += checkNoList[i] + ",";
        //            }

        //            for (var i = 0; i < values.length; i++) {
        //                PageNoList += values[i] + ",";
        //            }
        //            // var strwheres = $("#strwhere").val();
        //            if (checkNo != "") {
        //                // $("#popContent").attr("src", rootPath + "/Key_NSRXX/PropALLEdit?noList=" + checkNo + "&pageNoList=" + PageNoList + "&strwhere=" + strwheres);
        //                // codeModalMode.Show();
        //                //alert(checkNo)
        //                $.ajax({
        //                    type: 'POST',
        //                    url: rootPath + '/Key_NSRXX/DelNSRXX',
        //                    data: { NSRDZDAH: checkNo },
        //                    success: function (result) {
        //                        lpModal.Hide();
        //                        if (result == "exists") {
        //                            tbPZZL_DM.SetErrorText("编码已存在");
        //                            tbPZZL_DM.SetIsValid(false);
        //                        } else if (result == "ok") {
        //                            alert("删除成功！");
        //                            gvEditing.Refresh();
        //                            //window.location.href = rootPath + '/Key_NSRXX/Index';
        //                        } else if (result == "error") {
        //                            alert("保存失败");
        //                        }
        //                    }
        //                });
        //            }
        //            else {
        //                alert("未选中任何行");
        //            }
        //        }
        function codeOK() {
            codeModalMode.Hide();
            gvEditing.Refresh();
        }

        function codeOK1() {
            codeModalMode1.Hide();
            gvEditing.Refresh();
        }

        function codeCancel() {
            codeModalMode.Hide();
        }

        function codeCancel1() {
            codeModalMode1.Hide();
        }
        //重置
        function undo() {
            ASPxClientTextBox.Cast("NSRMC").SetText("");
            ASPxClientTextBox.Cast("FFileNo").SetText("");
    
            ASPxClientTextBox.Cast("FFinancePropNo").SetValue("");


        }

        function TaxPayerManagerALLEdit() {
            ASPxClientGridView.Cast("gvEditing").GetPageRowValues("NSRDZDAHstr", onvalues);
        }


        function onvalues() {
            //alert("");
            var checkNo = "";
            var PageNoList = "";
            var checkNoList = ASPxClientGridView.Cast("gvEditing").GetSelectedKeysOnPage();
            //            for (var i = 0; i < checkNoList.length; i++) {
            //                checkNo += checkNoList[i] + ",";
            //            }

            //            for (var i = 0; i < values.length; i++) {
            //                PageNoList += values[i] + ",";
            //            }
            //            var strwheres = $("#strwhere").val();
            if (checkNoList.length > 1) {
                //                $("#popContent").attr("src", rootPath + "/Key_NSRXX/PropALLEdit?noList=" + checkNo + "&pageNoList=" + PageNoList + "&strwhere=" + strwheres);
                //                codeModalMode.Show();
                alert("只能选择一行");
            }
            else if (checkNoList.length == 0) {
                alert("未选中任何行");
            }
            else {
                //alert("");
                checkNo = checkNoList[0];
                //alert("1");window.location.href
                window.location.href = rootPath + "/AllowancePay/AllowancePayEdit?FApplicationFormID=" + checkNo;
            }
        }

        function TaxPayerManagerEdit(id) {
            $("#popContent").attr("src", rootPath + "/Key_NSRXX/PropEdit?NSRDZDAH=" + id);
            codeModalMode.Show();
        }
        function codeEdit(id) {
            window.location.href = rootPath + "/AllowancePay/AllowancePayEdit?FApplicationFormID=" + id;
        }
    </script>
</head>
<body>
    <div>
        @Html.DevExpress().Menu(settings =>
        {
            settings.Name = "toolBarMenu";
            settings.ItemAutoWidth = false;
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
            settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

            //settings.Items.Add(item =>
            //{
            //    item.Name = "btnAdd";
            //    item.Text = "拨付";
            //    //item.ClientEnabled =false;
            //   // item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");

            //});
            //settings.Items.Add(item =>
            //{
            //    item.Name = "btnDelete";
            //    item.Text = "批量删除";
            //    item.ItemStyle.ForeColor = System.Drawing.Color.Red;
            //    item.ClientEnabled = true;
            //    item.Image.Url = Url.Content("~/Content/ControlImages/cancel.png");

            //});




            settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
            settings.ItemLinkMode = ItemLinkMode.ContentBounds;
        }).GetHtml()
    </div>
    <table width="100%" class="tableForm">
        <tr>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "文件号:"; }).GetHtml()
            </td>
            <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FFileNo";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(130);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "纳税人名称:"; }).GetHtml()
            </td>
            <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "NSRMC";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(130);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "资金性质:"; }).GetHtml()
            </td>
            <td class="tdClass">
                @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FFinancePropNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(130);
                   settings.Properties.TextField = "FFinancePropShortName";
                   settings.Properties.ValueField = "FFinancePropNo";
               }).BindList(ViewData["FinancePropList"]).Bind(ViewData["FFinancePropNo"]).GetHtml()
            </td>
            <td class="tdClass">
                @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnSearch";
                settings.Text = "查询";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
                settings.ClientSideEvents.Click = "search";
            }).GetHtml()
                @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnUndo";
                settings.Text = "重置";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/undo_blue.png");
                settings.ClientSideEvents.Click = "undo";
            }).GetHtml()
            </td>
        </tr>
    </table>
    @Html.Partial("AllowancePayManagerListPartial", Model)
    @Html.DevExpress().PopupControl(
    settings =>
    {
        settings.Name = "codeModalMode";
        settings.Width = 600;
        settings.Height = 250;
        settings.AllowDragging = true;
        settings.CloseAction = CloseAction.CloseButton;
        settings.EnableAnimation = false;
        settings.HeaderText = "纳税户设置";
        settings.Modal = true;
        settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
        settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
        settings.ShowFooter = true;
        settings.SetFooterTemplateContent(s =>
        {
            ViewContext.Writer.Write("<table align='center'><tr><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnOK";
                footBtnSettings.Text = "确定";
                footBtnSettings.ClientSideEvents.Click = "function(s,e){popContent.OK()}";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnCancel";
                footBtnSettings.Text = "取消";
                footBtnSettings.ClientSideEvents.Click = "codeCancel";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td></tr></table>");

        });
        settings.SetContent(() =>
       {
           ViewContext.Writer.Write("<iframe  id='popContent' name='popContent' style='width:100%;height:200px' frameborder='0' ></iframe>");
       });
    }).GetHtml()
    @* @Html.DevExpress().PopupControl(
    settings =>
    {
        settings.Name = "codeModalMode1";
        settings.Width = 700;
        settings.Height = 400;
        settings.AllowDragging = true;
        settings.CloseAction = CloseAction.CloseButton;
        settings.EnableAnimation = false;
        settings.HeaderText = "添加纳税人";
        settings.Modal = true;
        settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
        settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
        settings.ShowFooter = true;
        settings.SetFooterTemplateContent(s =>
        {
            ViewContext.Writer.Write("<table align='center'><tr><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnOK1";
                footBtnSettings.Text = "确定";
                footBtnSettings.ClientSideEvents.Click = "function(s,e){popContent1.TaxPayerManagerALLEdit()}";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnCancel1";
                footBtnSettings.Text = "取消";
                footBtnSettings.ClientSideEvents.Click = "codeCancel1";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td></tr></table>");

        });
        settings.SetContent(() =>
       {
           ViewContext.Writer.Write("<iframe  id='popContent1' name='popContent1' style='width:100%;height:400px' frameborder='0' ></iframe>");
       });
    }).GetHtml()*@
    @Html.Hidden("strwhere", ViewData["strwhere"])
    @Html.Hidden("hidNSRMC", ViewData["NSRMC"])
    @Html.Hidden("FFileNo", ViewData["FFileNo"])
    @Html.Hidden("hidHY_DM", ViewData["HY_DM"])
    @Html.Hidden("hidFFinancePropNo", ViewData["FFinancePropNo"])
    @Html.Hidden("hidFEnterprisePropNo", ViewData["FEnterprisePropNo"])
    @Html.Hidden("hidIsNoFull", ViewData["IsNoFull"])
    <script>
        lp.Hide();
    </script>
</body>
</html>
